<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author:LJQ <liujiqi@etrol.com>
// +-----------------------------------------------------------------------

namespace app\duty\model;

use app\common\model\Base;
use app\common\model\User;
use app\duty\model\Events;

/**
 * 记录回放管理
 */
class Replay extends Base{


    protected $name = 'emergencyinfo';
    protected $createTime = 'createTime';
    protected $updateTime = 'updateTime';

    public $msgTypeList=[] ;

    public  function getType(){

        $msgType=db('basicinfo')->where(array('sysCode'=>35))->column('subsystemName','subsystemNo');
        $this->msgTypeList=$msgType;
        return $this->msgTypeList;
    }



    public function getmsgAttr($value,$data){
        $this->getType();
        if($data['msgType']){
            return $this->msgTypeList[$data['msgType']];
        }
        return null;
    }

    public function user() {
        return $this->hasOne(User::class,'id','sendPersonId');
    }


    public function events() {
        return $this->hasOne('events','id','eventId');
    }

    public function  getSendTimeAttr($value,$data){

     return  date("Y-m-d H:i:s",$value);

    }
}